<%@ include file="/common/taglibs.jsp"%>
<probiz:pageHeading pageHeadingKey="menu.schedulerManagement" />
<content tag="buttons">
	<probiz:iconBtn btnType="start" onclick="return fnDoAction(this.form,'run');" btnTextKey="button.start" disabled="${(scheduler.inStandbyMode or !scheduler.started)?'no':'yes'}"/>
	<probiz:iconBtn btnType="stop" onclick="return fnDoAction(this.form,'stop');" btnTextKey="button.stop" disabled="${(!scheduler.inStandbyMode and scheduler.started)?'no':'yes'}"/>
</content>


<div class="top clearfix">
	<ul class="tab">
		<li class="curr"><span><fmt:message key="menu.schedulerManagement"/></span></li>
	</ul>
</div>
<form class="mainForm" method="post" action="${ctxPath}${isEaiScheduler?'/system/eaiScheduler.html':'/system/scheduler.html'}">
    <div class="modify">
		<c:forEach begin="0" end="${(groupSize - 1) < 0? 0: (groupSize - 1)}" var="i">
             <c:set var="groupName_param">groupName${i}</c:set>
             <c:set var="triggers_param">groupTriggers${i}</c:set>
			<div class="box_01">
				<div class="top">
					<div class="cnt">
						<h3><fmt:message key="scheduler.grounpName"/>:<c:if test="${not empty requestScope[groupName_param]}"><fmt:message key="scheduler.group.${requestScope[groupName_param]}"/></c:if></h3>
					</div>
				</div>
				<div class="content">
					<display:table htmlId="item${i}" name="${requestScope[triggers_param]}" cellspacing="0" cellpadding="0" uid="item"
		                 class="list_table" export="false" requestURI="">
		                 <display:column style="width: 20%;" sortable="false" headerClass="data-table-title" titleKey="scheduler.taskName"
		                     decorator="com.probiz.estore.core.decorator.TblColumnDecorator">
		                     <%-- TODO V3.5 全改成第一种方式显示--%>
		                     <c:if test="${isEaiScheduler}"><fmt:message key="${item.trigger.group}.${item.trigger.name}"/></c:if>
		                     <c:if test="${not isEaiScheduler}">${item.trigger.jobName}</c:if>
		                 </display:column>
		                 <display:column style="width: 10%;" sortable="false" headerClass="data-table-title" titleKey="scheduler.lastRunTime"
		                     decorator="com.probiz.estore.core.decorator.TblColumnDecorator">
		                     <fmt:formatDate value="${item.trigger.previousFireTime}" pattern="yyyy-MM-dd HH:mm:ss" />&nbsp;</display:column>
		                 <display:column style="width: 10%;" sortable="false" headerClass="data-table-title" titleKey="scheduler.nextRunTime"
		                     decorator="com.probiz.estore.core.decorator.TblColumnDecorator">
		                     <fmt:formatDate value="${item.trigger.nextFireTime}" pattern="yyyy-MM-dd HH:mm:ss" />&nbsp;</display:column>
		                 <display:column sortable="false" headerClass="data-table-title" titleKey="scheduler.desc" maxLength="60"
		                     decorator="com.probiz.estore.core.decorator.TblColumnDecorator">
		                     ${item.trigger.description}</display:column>
		                 <display:column style="width: 5%;" sortable="false" headerClass="data-table-title" titleKey="common.message.status"
		                     decorator="com.probiz.estore.core.decorator.TblColumnDecorator">
			                 <c:if test="${item.status == 0}"><font color="green"><fmt:message key="scheduler.itemStatus0"/></font></c:if>
			                 <c:if test="${item.status == 1}"><fmt:message key="scheduler.itemStatus1"/></c:if>
			                 <c:if test="${item.status == 2}"><fmt:message key="scheduler.itemStatus2"/></c:if>
			                 <c:if test="${item.status == 3}"><font color="red"><fmt:message key="scheduler.itemStatus3"/></font></c:if>
			                 <c:if test="${item.status == 4}"><font color="blue"><fmt:message key="scheduler.itemStatus4"/></font></c:if>
			                 <c:if test="${item.status == -1}"><fmt:message key="scheduler.itemStatus5"/></c:if>
		                 </display:column>
		                 <display:column style="width: 12%;" sortable="false" headerClass="data-table-title" titleKey="productReview.action"
		                     decorator="com.probiz.estore.core.decorator.TblColumnDecorator">
		                     <c:if test="${item.status != 1}">
		                    	 <a href="?doAction=pausedTrigger&trigger=${item.trigger.name}&group=${requestScope[groupName_param]}"><fmt:message key="scheduler.itemStatus1"/></a>
		                    </c:if>
		                    <c:if test="${item.status == 1}">
		                         <a href="?doAction=resumeTrigger&trigger=${item.trigger.name}&group=${requestScope[groupName_param]}"><fmt:message key="scheduler.start"/></a>
		                    </c:if>
		                     | <a href="${ctxPath}${isEaiScheduler?'/system/eaiScheduler.html':'/system/scheduler.html'}?doAction=edit&trigger=${item.trigger.name}&group=${requestScope[groupName_param]}"><fmt:message key="common.iconBtn.edit"/></a>
		                 </display:column>
		             </display:table>
					</div>
				</div>
               <script type="text/javascript">
				highlightTableRows("item${i}");
			   </script>
		</c:forEach>
    </div>
    <input type="hidden" name="doAction" value="" />
</form>
